package com.waves.task.event.listener;

import com.waves.core.constant.redis.UserRedisKey;
import com.waves.core.utils.RedisUtils;
import com.waves.task.domain.pojo.GeoEventPOJO;
import com.waves.task.event.TaskUserGeoEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * 创建任务、修改任务等操作的事件监听
 */
@Component
public class TaskUserGeoListener {

    @Order(1)
    @Async
    @EventListener
    public void handleEvent(TaskUserGeoEvent event) {
        String key = UserRedisKey.USER_INFO_GEO;
        GeoEventPOJO pojo = event.getPojo();
        RedisUtils.gSet(key, pojo.getX(), pojo.getY(), pojo.getUid().toString(), 365);
    }


}
